# coding:utf-8
import json
with open(r'D:\文献-分类\minshi.json',encoding='UTF-8') as f:
    tree=json.load(f)
    root=tree[0]
# 准备保存叶子的list
leafs = []
# 递归获取所有叶子节点
def getAllLeafs(root):
    if 'childlist' in root.keys():
        for i in range(root['label_count']):
            getAllLeafs(root['childlist'][i])
    else:
        leafs.append(root['DM'])
    return leafs
#leafs=getAllLeafs(root)
#print(leafs)